package org.example.elm_xiangmu.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.example.elm_xiangmu.po.Business;
import org.example.elm_xiangmu.po.Food;
import org.example.elm_xiangmu.result.Result;
import org.example.elm_xiangmu.service.BusinessService;
import org.example.elm_xiangmu.service.FoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("/Food")
@Tag(name="食物")
public class FoodController {
    @Autowired
    private FoodService foodService;

    @Operation(summary = "根据商家编号查询所属食品信息")
    @GetMapping("/listFoodByBusinessId/{businessId}")
    public Result listFoodByBusinessId(@Parameter(description = "商家id") @PathVariable Integer businessId) {

        List<Food> foodList = foodService.list(businessId);
        return Result.success(foodList,"查找食物成功");
    }


}
